/**
 * NonAddChildContainer
 *
 * @author		Allen Chou
 * @version		1.0.0 (last update: Aug 3 2008)
 * @link        http://cjcat.blogspot.com
 * @link		http://cjcat2266.deviantart.com
 */

package idv.cjcat.display {
	import flash.display.*;
	import flash.errors.IllegalOperationError;

	public class NonAddChildContainer extends MovieClip {
		
		//use this Sprite instance for children-adding functionality
		protected var _sprite:Sprite = new Sprite();
		
		public function NonAddChildContainer() {
			super.addChild(_sprite);
		}
		
		override public function addChild(obj:DisplayObject):DisplayObject {
			return _sprite.addChild(obj);
		}
		
		override public function addChildAt(obj:DisplayObject, index:int):DisplayObject {
			throw new IllegalOperationError("this method is not available for objects of NonAddChildContainer class");
			return null;
		}
		
		override public function removeChild(obj:DisplayObject):DisplayObject {
			throw new IllegalOperationError("this method is not available for objects of NonAddChildContainer class");
			return null;
		}
		
		override public function removeChildAt(index:int):DisplayObject {
			throw new IllegalOperationError("this method is not available for objects of NonAddChildContainer class");
			return null;
		}
		
	}
}